#include <windows.h>
#include <vector>

class Worker:public OVERLAPPED
{

private:
	HANDLE hThread;
	//overlapped->hEvent  //signed when error
	
	bool mbConnected;
	
	HANDLE hPipe;
	void request_async(std::string cmd);
	bool request_sync(std::string cmd,std::string& result);
	
public:
	int  mIOerror;

	bool init();
	bool close();

	void wait_response();
	void request_finished();
	

	bool is_recording();
	bool start_capture(int left,int top,int width,int height);
	bool stop_capture();

	Worker();
	~Worker();
};


//commands:
//"CRECO %d %d %d %d"-----start record
//   SRECO 1/0
//"CSTAT"			 -----get record state
//    SSTAT 1/0 framecnt 
//"CSTOP"			 -----stop record
//	  SSTOP 1/0